<template>
    <div>
    <el-dialog title="详情" :visible.sync="isOpen" width="60%" :before-close="closeDelDialog" :modal-append-to-body="false">
        <el-table :data="tableData" border style="width: 100%">
            <el-table-column prop="name" label="载体名称" width="180">
                <template slot-scope="scope">
                    <span v-for="(i, idx) in dict.type.CARRIER_TYPE" :key="idx">
                            {{ scope.row.name == i.value ? i.label : '' }}
                        </span>
              </template>
            </el-table-column>
            <el-table-column prop="code" label="载体编号" width="180">
            </el-table-column>
            <!-- "0":"失败""1":"成功” -->
            <el-table-column prop="success" label="是否成功">
                <template slot-scope="scope">
                {{scope.row.success=='1'?'是':'否'}}
                </template>
            </el-table-column>
            <!-- "0":"已完成""1":"未完成" -->
            <el-table-column prop="isRunning" label="是否完成">
                <template slot-scope="scope">
                {{scope.row.isRunning=='1'?'未完成':'已完成'}}
                </template>
            </el-table-column>
            <el-table-column prop="address" label="操作" width="110px">
                <template slot-scope="scope">
                    <el-button plain type="success" size="mini" @click="handleDetail(scope.row)">查看详情</el-button>
                </template>
            </el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="pageNum" :limit.sync="pageSize"
            @pagination="listByBatchIdList" />
    </el-dialog>

    <el-dialog title="载体检测结果详情" :visible.sync="isDetailOpen" width="60%" :before-close="closeDelDialog" :modal-append-to-body="false">
        <sxjcComponent istype="2" ref="child" :form="dataList" ></sxjcComponent>
     </el-dialog>
</div>
</template>
<script>
import { listByBatchId,inspectionLogs } from "@/api/cqbc/resourceManagement/yqCarriermanageDetail.js"
import sxjcComponent from "@/views/archive/archiveTransfer/sxjcComponent.vue";//移交四性检测详情， 打印用
export default {
    archive_Dicts: ['CARRIER_TYPE'],
    props: ["isOpen", 'row'],
    components: {
        sxjcComponent,
    },
    
    data() {
        return {
            batchId:undefined,
            pageNum:1,
            pageSize:10,
            tableData:[],
            loading: true,
            total:0,
            isDetailOpen:false,
               //检测信息
               dataList: [],
        }
    },
    watch: {
        row: {
            handler(val) {
                this.batchId=val.batchId
                this.listByBatchIdList();
            }, immediate: true
        }
    },
    methods: {
        closeDelDialog() {
            this.isDetailOpen=false
            this.$emit("closeDelDialog")
        },
        listByBatchIdList() {
            listByBatchId({
                batchId:this.batchId,
                pageNum:this.pageNum,
                pageSize:this.pageSize,
            }).then(response => {
                this.tableData = response.rows
                this.total = response.total
                this.loading = false
            })
        },
        //查看详情
        handleDetail(row) {
            this.isDetailOpen=true
            inspectionLogs(row.fourCheckId).then(res=>{
   
                this.dataList=res.data
            })
        }
    }
}
</script>
<style scoped></style>